<?php

namespace app\admin\controller\fastflow;
use app\admin\model\AuthRule;
use app\admin\model\fastflow\CancheckIndex;
use app\admin\model\fastflow\flow\Bill;
use app\common\controller\Backend;
use fastflow\api;
use think\Loader;

/**
 * 我的抄送
 *
 * @icon fa fa-circle-o
 */
class Billlist extends Backend
{
    protected $noNeedRight = [];

    protected $model = null;

    public function _initialize()
    {
        parent::_initialize();
    }



    /**
     * 查看
     */
    public function index()
    {
        $billModel = new Bill();
        $bill_list = $billModel->field(['bill_name', 'bill_table', 'controller'])->select();

        foreach ($bill_list as &$bill) {//查询可签章数
            $bill = $bill->toArray();
            $url = Loader::parseName($bill['controller'], 0);
            $bill['controller_url'] = str_replace('/_', '/', $url);
            //获取bill对应的rule id
            $auth_rule = new AuthRule();
            $rule = $auth_rule->where(['name' => $bill['controller_url']])->find();
            if ($rule){
                $bill['rule_id'] = $rule['id'];
            }
        }
        $this->view->assign(['billList' => $bill_list]);
        return $this->view->fetch();
    }


}
